package com.jerry.walking.module.activityTravel.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import android.widget.TextView;

import com.jerry.walking.R;
import com.jerry.walking.base.BaseActivity;
import com.jerry.walking.base.BaseApplication;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;

import butterknife.BindView;

/**
 * Created by Yang on 2016/5/13.
 *
 *      在推荐点击后每个图片的点击  显示大图片界面
 *
 */
public class BigPicture extends BaseActivity{

    private Intent intent;
    private String name;
    private String nikeName;
    private String cover;
    private String description;
    private String picture;
    private String fav_count;
    private String comment_count;

    @BindView(R.id.iv_travel_recommend_first_bigpicture)
    ImageView imageView;
    @BindView(R.id.image9)
    ImageView imageView1;

    @BindView(R.id.tv_travel_recommend_first_bigpicture1)
    TextView textView;
    @BindView(R.id.tv_travel_recommend_first_bigpicture2)
    TextView textView1;

    @BindView(R.id.sv_travel_recommend_first_bigpictue)
    ScrollView scrollView;
    @BindView(R.id.tv_travel_recommend_first_bigpicture)
    TextView textView2;

//    @BindView(R.id.tv_travel_recommend_first_bigpicture)
//    TextView textView3;
//    @BindView(R.id.tv_travel_recommend_first_bigpicture)
//    TextView textView4;

    private ImageLoader imageLoader;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_travel_recommend_frist_bigpicture;
    }

    @Override
    protected void initViews() {
        super.initViews();

        imageLoader = BaseApplication.getApplication().getImageLoader();

        intent = getIntent();

        name = intent.getStringExtra("name");
        nikeName = intent.getStringExtra("nikeName");
        cover = intent.getStringExtra("cover");
        description = intent.getStringExtra("description");
        picture = intent.getStringExtra("picture");
        fav_count = intent.getStringExtra("fav_count");
        comment_count = intent.getStringExtra("comment_count");

        if (!TextUtils.isEmpty(description)) {
            scrollView.setVisibility(View.VISIBLE);
            textView2.setText(description);
        } else {
            scrollView.setVisibility(View.GONE);
        }

        textView.setText(name);
        textView1.setText(nikeName);

        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheOnDisk(true)
                .cacheInMemory(true)
                .imageScaleType(ImageScaleType.EXACTLY)
                .build();
        imageLoader.displayImage(cover, imageView1, options);
        imageLoader.displayImage(picture, imageView, options);

        //头像跳转到用户界面中
        imageView1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //TODO  用户界面跳转
            }
        });
    }

    @Override
    protected void loadData() {
        super.loadData();
    }

    /**
     * 后退键
     * @param view
     */
    public void onBack(View view) {
        finish();
    }
}
